﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Drawing;

namespace LedDemo
{
    /// <summary>
    /// 控制设备类型
    /// </summary>
    public enum DeviceControlType : int
    {
        LedControl = 0x01,	        // 灯光控制
        USBControl = 0x02,		    // USB通断板 
    };

    /// <summary>
    /// 灯光板控制命令
    /// </summary>
    public enum LedControlCommand : int
    {
        None = 0,
        Init = 0x01,                   // 初始化电机设备       
        Exit = 0xFF,                    // 退出程序    
        SetLightOn = 0x10,                 // 亮灯
        SetLightOff = 0x11,                 // 灭灯
        SetLedFlash = 0x12,                // 闪灯     
    };

    public enum LEDS : int
    {
        None = 0,
        LED1 = 1,
        LED2 = 2,
        LED3 = 3,
    }

    [DataContract]
    public class LedActionArgs
    {
        /// <summary>
        /// 控制命令
        /// </summary>
        [DataMember]
        public LedControlCommand Command;
        
        /// <summary>
        /// 灯编号
        /// </summary>    
        [DataMember]
        public LEDS LedNum { get; set; }

        /// <summary>
        /// 速度
        /// </summary>
        [DataMember]
        public int Speed { get; set; }

        /// <summary>
        /// 次数
        /// </summary>
        [DataMember]
        public int Count { get; set; }

        /// <summary>
        /// 发送命令者的窗口句柄
        /// </summary>
        [DataMember]
        public IntPtr SenderHandle { get; set; }
    }

    public class LEDControlActionResult
    {
        /// <summary>
        /// 执行动作类型
        /// </summary>
        public LedControlCommand Command { get; set; }

        /// <summary>
        /// 灯编号
        /// </summary>
        public LEDS LedNum { get; set; }

        /// <summary>
        /// 动作执行完成返回的代码
        /// </summary>
        public int Code { get; set; }

        /// <summary>
        /// 动作执行完成返回的信息
        /// </summary>
        public string Message { get; set; }
    }
}
